package com.itgaohe.controller;

import com.itgaohe.service.VoucherOrderService;
import com.itgaohe.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 优惠券订单控制层
 */

@Slf4j
@RestController
@RequestMapping("/voucher-order")
@RequiredArgsConstructor
@Tag(name = "优惠券订单管理")
public class VoucherOrderController {
    private final VoucherOrderService voucherOrderService;
    //普通优惠券订单的创建
     @Operation(summary = "普通优惠券订单的创建")
     @PostMapping("/order/{voucherId}")
     public Result normalVoucherOrder(@PathVariable Long voucherId ) {
         Result normalVoucherOrder = voucherOrderService.createNormalVoucherOrder(voucherId);
         return normalVoucherOrder;
     }
     //秒杀有优惠券订单的创建
     @Operation(summary = "秒杀有优惠券订单的创建")
     @GetMapping("/seckill/{voucherId}")
     public Result seckillVoucherOrder(@PathVariable Long voucherId ) {
         Result seckillVoucherOrder = voucherOrderService.createSeckillVoucherOrder(voucherId);
         return seckillVoucherOrder;
     }




}
